package com.sdkj.recruit.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort.Order;
import org.springframework.data.geo.Distance;
import org.springframework.data.geo.GeoResults;
import org.springframework.data.geo.Point;
import org.springframework.data.mongodb.core.geo.Sphere;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.NearQuery;
import org.springframework.data.mongodb.core.query.Query;

import com.mongodb.BasicDBObject;
import com.sdkj.recruit.model.Company;
import com.sdkj.recruit.model.Paginate;
import com.sdkj.recruit.model.Position;

public interface IMongodbDAO {

	<T> T getPO(final Class<T> cls, final Serializable id);

	<T> T getPO(final Class<T> cls, final Criteria... queryParam);

	<T> List<T> getPOList(final Class<T> cls);

	<T> List<T> getPOListByIds(final Class<T> cls, final String[] ids);

	<T> List<T> getPOList(final Class<T> cls, final Criteria... queryParam);

	<T> List<T> getPOList(final Class<T> cls, final Paginate paginatePO,
			final List<Order> orders, final Criteria... queryParam);

	<T> Page<T> getPOPageList(final Class<T> cls, final Paginate paginatePO,
			final List<Order> orders, final Criteria... queryParam);

	<T> long getRowCount(final Class<T> cls, final Criteria... queryParam);

	<T> void saveOrUpdatePO(final T po);

	<T> void saveOrUpdatePOList(final List<T> boList);

	<T> void saveOrUpdateDocument(final Class<T> cls,
			final String propertyName, final Object propertyValue,
			final Criteria... queryParam);

	<T> void saveOrUpdateDocument(final Class<T> cls,
			final Map<String, Object> updatePropertys,
			final Criteria... queryParam);

	<T> void deleteDocument(final Class<T> cls, final String propertyName,
			final Criteria... queryParam);

	<T> void deleteDocument(final Class<T> cls, final String[] propertyNames,
			final Criteria... queryParam);

	<T> void saveArray(final Class<T> cls, final String propertyName,
			final Object value, final Criteria... queryParam);

	<T> void deleteArray(final Class<T> cls, final String propertyName,
			final Object value, final Criteria... queryParam);

	<T> void deleteArray(final Class<T> cls, final String propertyName,
			final Object[] values, final Criteria... queryParam);

	<T> void saveOrUpdateObjectArray(final Class<T> cls,
			final String propertyName, final Object value,
			final Criteria... queryParam);

	<T> void deleteObjectArray(final Class<T> cls, final String propertyName,
			final Criteria... queryParam);

	<T> void updateInc(final Class<T> cls, final String propertyName,
			final int inc, final Criteria... queryParam);

	<T> void deletePO(final T po);

	<T> void deletePO(final Class<T> cls, final Serializable id);

	<T> void deletePOList(final Class<T> cls, final List<T> poList);

	<T> void deletePOList(final Class<T> cls, final Criteria... queryParam);

	<T> List<T> getPoDistinct(String collectionName, String key,
			final Criteria... queryParam);

	<T> List<T> unionList(final List<Order> orderList, final int count,
			final List<T>... list);

	<T> void UpdateUnsetDocument(final Class<T> cls,
			final List<String> unsetPropertys, final Criteria... queryParam);

	<T> List<BasicDBObject> groupBy(final Class<T> cls, String propertyName,
			final Criteria... queryParam);
	
	<T> GeoResults<T> findByAddressLocationNear (Point point, Distance distance,Class<T> cls);

	<T> GeoResults<T> findByLocationNear(NearQuery query,
			Class<T> cls);

	List<Company> findByLocationNearNew(Query query,Sphere nearQuery, Class<Company> class1);
}
